
import requstInterceptor from './interceptor/req.js'
import {responceSucessInterceptor,responceFairInterceptor} from './interceptor/res.js'
/* 
	requestData : {url,method,header,responseType}等
 */
const request = (requestData)=>{
	// 添加拦截器
	uni.addInterceptor('request', {
	  invoke(args) {
		// 对请求参数的统一处理
	    args = requstInterceptor(args)
	  },
	  success(res) {
	    return responceSucessInterceptor(res)
	  }, 
	  fail(err) {
	    responceFairInterceptor(err)
	  }, 
	})
	
	return uni.request(requestData)
	
}

export default request